package com.xci.sys.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelIgnore;
import com.xci.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 系统模块
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(description = "系统模块")
public class SysModule extends BaseEntity {
    /**
     * 模块主键
     */
    @ExcelIgnore @Excel(name = "模块主键")
    @ApiModelProperty(value = "模块主键", required = true, position = 1)
    private String id;

    /**
     * 模块上级主键
     */
    @Length(max = 30, message = "模块上级主键不能超过{max}个字符")
    @ExcelIgnore
    @Excel(name = "模块上级主键")
    @ApiModelProperty(value = "模块上级主键", required = true, position = 2)
    private String parentId;

    /**
     * 模块名称
     */
    @NotBlank(message = "模块名称不能为空")
    @Length(max = 100, message = "模块名称不能超过{max}个字符")
    @Excel(name = "模块名称", width = 30d)
    @ApiModelProperty(value = "模块名称", required = true, position = 3)
    private String name;

    /**
     * 名称简拼
     */
    @Length(max = 100, message = "名称简拼不能超过{max}个字符")
    @ExcelIgnore@Excel(name = "简拼")
    @ApiModelProperty(value = "名称简拼", position = 4)
    private String spell;

    /**
     * 模块编码
     */
    @NotBlank(message = "模块编码不能为空")
    @Length(max = 100, message = "模块编码不能超过{max}个字符")
    @Excel(name = "模块编码", width = 30d)
    @ApiModelProperty(value = "模块编码", required = true, position = 4)
    private String code;

    /**
     * 模块参数
     */
    @Length(max = 1000, message = "模块参数不能超过{max}个字符")
    @Excel(name = "模块参数")
    @ApiModelProperty(value = "模块参数", position = 6)
    private String param;

    /**
     * Web地址
     */
    @Length(max = 200, message = "Web地址不能超过{max}个字符")
    @Excel(name = "Web地址")
    @ApiModelProperty(value = "Web" + "地址", position = 7)
    private String webUrl;

    /**
     * Web图标
     */
    @Length(max = 100, message = "Web图标不能超过{max}个字符")
    @Excel(name = "Web图标")
    @ApiModelProperty(value = "Web" + "图标", position = 8)
    private String webCls;

    /**
     * EasyUI图标
     */
    private String iconCls;

    /**
     * WinFrom窗口类
     */
    @Length(max = 200, message = "WinFrom窗口类不能超过{max}个字符")
    @Excel(name = "WinFrom窗口类")
    @ApiModelProperty(value = "WinFrom窗口类", position = 9)
    private String winProvider;

    /**
     * WinFrom大图标
     */
    @Length(max = 100, message = "WinFrom大图标不能超过{max}个字符")
    @Excel(name = "WinFrom大图标")
    @ApiModelProperty(value = "WinFrom大图标", position = 10)
    private String winLargeIcon;

    /**
     * WinFrom小图标
     */
    @Length(max = 100, message = "WinFrom小图标不能超过{max}个字符")
    @Excel(name = "WinFrom小图标")
    @ApiModelProperty(value = "WinFrom小图标", position = 11)
    private String winSmallIcon;

    /**
     * 是否显示为对话框 [是_1,否_0]
     */
    @NotNull(message = "请输入是否显示为对话框")
    @Excel(name = "是否显示为对话框", width = 20d, replace = { "是_1", "否_0" })
    @ApiModelProperty(value = "是否显示为对话框 [是_1,否_0]", required = true, position = 17)
    private Boolean winIsDialog;

    /**
     * 是否预加载 [是_1,否_0]
     */
    @NotNull(message = "请输入是否预加载")
    @Excel(name = "是否预加载", width = 20d, replace = { "是_1", "否_0" })
    @ApiModelProperty(value = "是否预加载 [是_1,否_0]", required = true, position = 18)
    private Boolean winIsPreloading;

    /**
     * 是否Web菜单 [是_1,否_0]
     */
    @NotNull(message = "请输入是否Web菜单")
    @Excel(name = "是否Web菜单", width = 20d, replace = { "是_1", "否_0" })
    @ApiModelProperty(value = "是否Web菜单 [是_1,否_0]", required = true, position = 12)
    private Boolean isWeb;

    /**
     * 是否WinForm菜单 [是_1,否_0]
     */
    @NotNull(message = "请输入是否WinForm菜单")
    @Excel(name = "是否WinForm菜单", width = 20d, replace = { "是_1", "否_0" })
    @ApiModelProperty(value = "是否WinForm菜单 [是_1,否_0]", required = true, position = 13)
    private Boolean isWin;

    /**
     * 是否展开 [是_1,否_0]
     */
    @NotNull(message = "请输入是否展开")
    @Excel(name = "是否展开", width = 20d, replace = { "是_1", "否_0" })
    @ApiModelProperty(value = "是否展开 [是_1,否_0]", required = true, position = 14)
    private Boolean isExpand;

    /**
     * 是否公开 [是_1,否_0]
     */
    @NotNull(message = "请输入是否公开")
    @Excel(name = "是否公开", width = 20d, replace = { "是_1", "否_0" })
    @ApiModelProperty(value = "是否公开 [是_1,否_0]", required = true, position = 15)
    private Boolean isPublic;

    /**
     * 是否菜单 [是_1,否_0]
     */
    @NotNull(message = "请输入是否菜单")
    @Excel(name = "是否菜单", width = 20d, replace = { "是_1", "否_0" })
    @ApiModelProperty(value = "是否菜单 [是_1,否_0]", required = true, position = 16)
    private Boolean isMenu;

    /**
     * 排序路径
     */
    @Excel(name = "排序路径")
    @ApiModelProperty(value = "排序路径", position = 8)
    private Integer path;

    /**
     * 启用状态 [启用_1,禁用_0]
     */
    @Excel(name = "启用状态", replace = {"启用_true", "禁用_false"})
    @ApiModelProperty(value = "启用状态 [启用_1,禁用_0]", position = 202)
    private Boolean status;

    /**
     * 备注
     */
    @Length(max = 200, message = "备注不能超过{max}个字符")
    @Excel(name = "备注", width = 40d)
    @ApiModelProperty(value = "备注", position = 100)
    private String remark;

    /**
     * EasyUI 展开状态
     */
    public String state;

    public String getIconCls() {
        return webCls;
    }
}